package com.example.demo.user.controller;

import com.example.demo.user.entity.UUserLogin;
import com.example.demo.user.service.UServiceUserService;
import com.example.demo.user.vo.ServiceUserVo;
import com.example.demo.util.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/userController")
@Tag(name = "userController", description = "pc后台登录注册")
public class UUserLoginController {

    @Autowired
    private UServiceUserService uServiceUserService;

    /**
     * 登录
     */
    @PostMapping("/login")
    @Operation(summary = "后台登录", description = "后台登录接口")
    public Result<?> login(@RequestBody UUserLogin user) {
        return uServiceUserService.login(user);
    }

    /**
     * pc注册
     */
    @PostMapping("/register")
    @Operation(summary = "账号注册", description = "后台注册接口、原型中人员管理-新增")
    public Result<?> register(@RequestBody ServiceUserVo user) {
        return uServiceUserService.register(user);
    }
}
